package com.tom.demo.service.stockmarket.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tom.demo.common.entity.StockMarketAsync;
import com.tom.demo.mapper.StockMarketAsyncMapper;
import com.tom.demo.service.stockmarket.StockMarketAsyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class StockMarketAsyncServiceImpl implements StockMarketAsyncService {

    @Resource
    private StockMarketAsyncMapper stockMarketAsyncMapper;

    @Override
    public ResponseEntity<PageInfo<StockMarketAsync>> pageList(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<StockMarketAsync> stockMarketAsyncList = stockMarketAsyncMapper.findByPage();
        PageInfo<StockMarketAsync> pageInfo = new PageInfo<>(stockMarketAsyncList);
        return ResponseEntity.ok(pageInfo);
    }
}
